package org.example.controller;

import org.example.entity.AttendanceRule;
import org.example.models.R;
import org.example.service.AttendanceRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/attendanceRule")
public class AttendanceRuleController {

    @Autowired
    private AttendanceRuleService attendanceRuleService;

    @GetMapping("/rules")
    public R<AttendanceRule> getAllAttendanceRule(@RequestParam(name = "ruleId", required = false, defaultValue = "1") Integer ruleId) {
        return R.success(attendanceRuleService.getById(ruleId));
    }

}
